<template>
  <div class="studay">
    <div class="header">
      <h2>请选择</h2>
      <div class="search">
        <span class="iconfont icon-query1"></span>
        <input type="text" placeholder="输入课程或者教师名称" />
      </div>
      <div class="kechen">
        <span class="iconfont icon-lingdang"></span>
        <p>我的课程</p>
      </div>
    </div>
    <div class="con">
      <Banner />
      <div class="nav">
        <ul>
          <li v-for="gong in gongnengs" :key="gong.id">
            <router-link :to="'/english/' + gong.id">
              <img :src="gong.img" alt="" />
            </router-link>
            <p>{{ gong.title }}</p>
          </li>
          <!-- <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li>
          <li>
            <img src="../../public/images/4.jpg" />
            <p>实用英语</p>
          </li> -->
        </ul>
      </div>
      <div class="xian"></div>
      <div class="openclass">
        <div class="top">
          <h2>公开课</h2>
          <div class="right">
            <p>查看更多</p>
            <span class="iconfont icon-jiantou"></span>
          </div>
        </div>
        <div class="bottom">
          <ul>
            <li v-for="studay in studays" :key="studay.id">
              <img :src="studay.img" alt="" />
              <div class="you">
                <h3>{{ studay.title }}</h3>
                <p>
                  <i>{{ studay.teacher }}</i>
                  <b>{{ studay.xiaoliang }}</b>
                </p>
                <span>{{ studay.miaoshu }}</span>
              </div>
            </li>
            <li></li>
          </ul>
        </div>
      </div>
      <div class="option">
        <div class="top">
          <h2>精选好课</h2>
        </div>
        <div class="bottom">
          <ul>
            <li v-for="goodcla in goodclass" :key="goodcla.id">
              <div class="li1">
                <span>{{ goodcla.biaoqian }}</span>
                <h3>单{{ goodcla.title }}</h3>
              </div>
              <div class="li2">
                开课时间:
                <p>{{ goodcla.time }}</p>
                <i>{{ goodcla.classtime }}</i
                >课时
              </div>
              <div class="li3">
                <div class="zuo">
                  <img :src="goodcla.img" alt="" />
                  <p>{{ goodcla.teacher }}</p>
                </div>
                <div class="you">
                  <p>免费</p>
                  <span
                    >已有<i>{{ goodcla.num }}人报名</i></span
                  >
                </div>
              </div>
            </li>
          </ul>
        </div>
      </div>
    </div>

    <dibu></dibu>
  </div>
</template>
<script>
import axios from "axios";
import dibu from "../components/dibu.vue";
import Banner from "./Banner.vue";
export default {
  name: "Studay",
  components: {
    dibu,
    Banner,
  },

  data() {
    return {
      studays: [],
      goodclass: [],
      gongnengs: [],
    };
  },
  created() {
    axios({
      url: "http://localhost:3000/studays",
      method: "get",
      params: {},
    }).then((res) => {
      //res.data直接就是后端返回来的数据，并且是json数据
      this.studays = res.data;
    }),
      axios({
        url: "http://localhost:3000/goodclass",
        method: "get",
        params: {},
      }).then((res) => {
        //res.data直接就是后端返回来的数据，并且是json数据
        this.goodclass = res.data;
      }),
      axios({
        url: " http://localhost:3000/gongnengs",
        method: "get",
        params: {},
      }).then((res) => {
        //res.data直接就是后端返回来的数据，并且是json数据
        this.gongnengs = res.data;
      });
  },
};
</script>
<style scoped>
@import url(../assets/iconfont.css);
.studay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
.header {
  width: 100%;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  color: #fff;
  font-size: 18px;
  position: fixed;
  top: 0;
  left: 0;
  background-color: #fff;
  z-index: 10;
}
.header h2 {
  font-weight: 700;
  color: #000;
  font-size: 0.25rem;
}
.header .search {
  display: flex;
  align-items: center;
  width: 2rem;
  height: 0.4rem;
  background-color: #f3f3f3;
}
.header .search .icon-query1 {
  font-size: 0.2rem;
  color: #000;
  margin-right: 0.1rem;
  margin-left: 0.02rem;
}
.header .search input {
  height: 0.4rem;
  background-color: #f3f3f3;
  font-size: 0.14rem;
  color: #000;
}
.header .kechen span {
  font-size: 0.25rem;
  margin-left: 0.1rem;
}
.header .kechen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #000;
}
.header .kechen p {
  font-size: 0.12rem;
  color: #000;
}
.con {
  width: 93%;
}
.con .nav {
  /* width: 100%; */
  height: 1rem;
}
.con .nav ul {
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.con .nav ul li {
  width: 23%;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}
.con .nav ul li p {
  font-size: 0.12rem;
  margin-top: 0.15rem;
}
.con .nav ul li img {
  width: 0.5rem;
  height: 0.5rem;
}
.xian {
  width: 100%;
  height: 0.02rem;
  background-color: #fef0ed;
}
.openclass .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 0.5rem;
}
.openclass .top h2 {
  font-weight: 700;
}
.openclass .top .right p {
  font-size: 0.14rem;
  color: #9b9999;
}
.openclass .top .right {
  display: flex;
  align-items: center;
}
.openclass .top .right span {
  font-size: 0.14rem;
  color: #9b9999;
}
.openclass .bottom ul li {
  display: flex;
  margin: 0.2rem 0;
}
.openclass .bottom img {
  width: 0.9rem;
  height: 1.2rem;
  margin-right: 0.2rem;
}
.openclass .bottom .you h3 {
  font-weight: 700;
  margin-bottom: 0.11rem;
}
.openclass .bottom .you p b {
  font-weight: 400;
  color: red;
  border: 0.01rem solid red;
  border-radius: 0.1rem;
  font-size: 0.13rem;
  padding: 0.03rem;
  margin-left: 0.1rem;
}
.openclass .bottom .you p {
  margin-bottom: 0.13rem;
}
.openclass .bottom .you p i {
  font-weight: 700;
  color: rgb(66, 66, 66);
}
.openclass .bottom .you h3 {
  font-weight: 700;
}
.openclass .bottom .you h3 {
  font-weight: 700;
}
.openclass .bottom .you span {
  font-size: 0.12rem;
  color: rgb(98, 98, 99);
}
.option {
  width: 100%;
}
.option .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 0.5rem;
}
.option .top h2 {
  font-weight: 700;
}
.option .bottom {
  display: flex;
  margin-bottom: 0.2rem;
}
.option .bottom .li1 {
  display: flex;
}
.option .bottom .li1 span {
  background-color: #818894;
  color: #fff;
  border-radius: 0.05rem;
  padding: 0.05rem;
  font-size: 0.12rem;
}
.option .bottom .li1 h3 {
  margin-left: 0.15rem;
  font-weight: 700;
}
.option .bottom .li2 {
  display: flex;
  color: #9b9999;
  align-items: center;
  height: 0.14rem;
  font-size: 0.14rem;
  margin: 0.1rem 0rem;
}
.option .bottom .li2 i {
  margin-left: 0.2rem;
}
.option li {
  margin-bottom: 0.2rem;
}
.option .bottom {
  width: 100%;
}
.option .bottom .li3 {
  display: flex;
  width: 100%;
  height: 0.7rem;
  justify-content: space-between;
  border-bottom: 0.01rem solid #9b9999;
}
.option .bottom .li3 .zuo {
  margin-right: 1.8rem;
}
.option .bottom .li3 .zuo img {
  width: 0.3rem;
  height: 0.3rem;
}
.option .bottom .li3 .zuo p {
  font-size: 0.1rem;
  color: #9b9999;
}
.option .bottom .li3 .you p {
  color: red;
  font-weight: 700;
  margin-left: 0.7rem;
}
.option .bottom .li3 .you span {
  color: #9b9999;
  font-size: 0.14rem;
}
</style>